<template>
  <div class='container'>
    <el-dialog title="题目审核" :visible.sync="showAudit" width="20%">
      <el-form>
        <el-form-item>
          <el-radio :label="1" v-model="auditData.chkState">通过</el-radio>
          <el-radio :label="2" v-model="auditData.chkState">拒绝</el-radio>
        </el-form-item>
        <el-form-item>
          <el-input type="textarea" v-model="auditData.chkRemarks" placeholder="请输入审核意见"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="showAudit = false">取 消</el-button>
        <el-button type="primary" @click="choiceCheck">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  name: 'QuestionsCheck',
  props: {
    data: {
      type: Object
    }
  },
  data () {
    return {
      showAudit: false,
      auditData: {
        id: '',
        chkState: 1,
        chkRemarks: ''
      }
    }
  },
  methods: {
    open () {
      this.showAudit = true
    },
    async choiceCheck () {
      if (!this.auditData.chkRemarks) return this.$message.warning('请输入审核意见')
      this.auditData.id = this.data.id
      await choiceCheck(this.auditData)
      this.$message.success('修改成功')
      this.showAudit = false
      this.$emit('updateList')
    }
  }
}
</script>

<style scoped lang='scss'>
</style>
